package exercise;

/*
a、有员工类（父类），普通员工类（员工类的子类）和部门经理类（员工类的子类）
普通员工工资=单日工资* 天数 * 等级（1）；部门经理工资=1000+单日工资天数等级（1.2）。
b、员工类的属性和方法
属性：单日工资，工作天数，工资等级
方法：打印工资方法
c、子类按照本类特点重写打印工资方法
d、写测试类，输出各类的工资（同时代码验证重写的规则）

 */
public class ex3 {
    public static void main(String[] args) {
        CommonEmployee commonEmployee = new CommonEmployee(100, 10, 1);
        commonEmployee.printSalary();
        Manager manager = new Manager(100, 10, 1.2);
        manager.printSalary();
    }
}

class Employee {
     double salary;
     int workDays;
     double grade;
     public Employee(double salary, int workDays, double grade) {
         this.salary = salary;
         this.workDays = workDays;
         this.grade = grade;
     }

    public void printSalary() {
        System.out.println("工资=" + salary * workDays * grade);
    }

}

class CommonEmployee extends Employee {
    public CommonEmployee(double salary, int workDays, double grade) {
        super(salary, workDays, grade);
    }

    @Override
    public void printSalary() {
        System.out.println("普通员工工资=" + salary * workDays * grade);
    }
}

class Manager extends Employee {
    public Manager(double salary, int workDays, double grade) {
        super(salary, workDays, grade);
    }
    @Override
    public void printSalary() {
        System.out.println("部门经理工资=" + (1000 + salary * workDays * grade));
    }
}